<template>
  <div class="stepitem base_set">
    <!-- 标注环节设置 -->
    <MarkEnvironmentSet ref="markEnvironmentSet"/>
    <!-- 积分设置 -->
    <IntegralSet ref="integralSet"/>
    <!-- 数据导入 -->


    <!-- 术语导入 -->


  </div>
</template>
<script>
import IntegralSet from '@/components/create-batch/IntegralSet'
import MarkEnvironmentSet from '@/components/create-batch/MarkEnvironmentSet'

import $ from 'jquery'
export default {
  name: "BaseSetting",
  data() {
    return {
      edit: false,
      info: {
        languageType: "", // 语言类型
        languageList: []
      },

      // 术语导入
      isTerm: false,// 是否开启 导入术语
      selectingTerm: false,// 是否 正在 选择话术
      selectTermName: '',// 选中的话术名
      termRid: '',// 话术文件id
    };
  },
  props: ["editBaseData"],
  created() {
    if (this.editBaseData) {
      // 继承老批次数据
      Object.keys(this.editBaseData).forEach(key => {
        if (this.$data.hasOwnProperty(key)) {
          this.$set(this, key, val[key])
        }
      })
    }
  },
  watch: {
  },
  methods: {
    cancel: function () {
      this.importBox = false;
      // 标签配置
      // this.tagInfo.cname = "";
      // this.tagInfo.ename = "";
    },
    // 数据导入 信息删除
    deleteMyrid: function (type) {
      if (type == 0) {
        this.myrid = "";
      } else {
        this.termRid = "";
      }
    },
    // 点击导入云盘数据 根目录选项
    locBakTree: function (index, rid) {
      if (index == "" || index == undefined || index == null) {
        this.selectTree = [];
        this.myrid = "";
        this.selectFileRid = "";
        this.getFileTree("", "css");
      } else {
        this.selectTree.splice(index, this.selectTree.length);
        this.myrid = rid;
        this.getFileTree(rid, "css");
      }
    },
    // 打开云盘
    openTree: function (rid, name) {
      this.getFileTree(rid, "css", name);
    },
    changefile: function (rid, name, type) {
      if (type != "file") {
        this.selectFileRid = rid;
        if (this.selectingTerm) {
          this.selectTermName = name;
        } else {
          this.selectFileName = name;
        }
      } else {
        //音频文件不可选，只能选文件夹
      }
    },
    // 云盘数据请求方法
    async getFileTree(path, type, name) {
      var self = this;
      let params = {
        type,
        fileType: 0
      };
      if (path == "") {
        params.path = "";
        // proxyurl = "/v1/be/common/files?path= ;
      } else {
        params.path = { rid: path };
        // '/v1/be/common/files?path={"rid":"' + path + '"}'
      }
      if (this.importStatus) {
        this.importStatus = false;
        await this.ass_api.getCloudInfo(params).then(data => {
          if (!data) return;
          self.importStatus = true;
          if (data.length > 0) {
            self.fileList = data;
            if (name != "" && name != null && name != undefined) {
              var newdata = new Object();
              newdata.rid = path;
              newdata.name = name;
              self.selectTree.push(newdata);
              self.myrid = "";
            }
          } else {
            self.ui.fade("当前目录没有可打开的文件");
          }
        });
      }
    },
    // 云盘数据选择确定保存
    saveTree: function () {
      if (this.selectFileRid != "") {
        // this.myrid = this.selectFileRid;
        if (this.selectingTerm) {
          this.termRid = this.selectFileRid;
        } else {
          this.myrid = this.selectFileRid;
        }
        this.importBox = false;
        this.selectTree = [];
        this.selectFileRid = "";
      } else {
        console.log("没选择云盘");
      }
    },
    // 打开云盘选择列表
    selectImpType: function (n) {
      ////
      if (n == 1) {
        this.selectingTerm = true;
      } else {
        this.selectingTerm = false;
      }
      this.importType = 0;
      if (n == 0 || n == 1) {
        this.importBox = true;
        this.getFileTree("", "css");
      } else {
        this.importBox = false;
      }
    },
    // 获取url带的参数
    GetQueryString: function (name) {
      //流转任务时获取batchid
      var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
      var r = window.location.search.substr(1).match(reg);
      if (r != null) return unescape(r[2]);
      return null;
    },
    closeResult() {
      window.location.href = "/manager/index/batch";
    }
  },
  mounted: function () {
    var self = this;
        console.log(this.$refs,' ehjhjkdasjdh')

    // 获取所有字典集合列表
    self.ass_api.dictionaryList().then(data => {
      if (!data) return;
      self.info.languageList = data;
      if (self.edit == false) {
        self.info.languageType = self.info.languageList[0].key;
      }
    });
  },
  components: {
    IntegralSet, // 积分设置
    MarkEnvironmentSet, // 检查设置
  }
};
</script>
<style lang="less" scoped>
@import "~@/assets/css/common/create_bat.css";
.base_set {
  .title {
    color: #5e6a68;
    font-size: 16px;
    font-weight: 700;
    line-height: 48px;
    display: block;
    position: relative;
    padding-left: 14px;
    margin-top: 10px;
  }
  .title:before {
    position: absolute;
    left: 0;
    top: 17px;
    width: 4px;
    height: 15px;
    display: block;
    background: #07d569;
    content: "";
  }
  .title p {
    padding: 5px 23px;
    display: inline;
    font-size: 12px;
    font-weight: normal;
    color: #e07900;
  }
}
.stepitem {
  position: relative;
  margin-bottom: 15px;
  &:after {
    content: "";
    display: block;
    clear: both;
    height: 0;
  }
  label {
    width: 100px;
    padding-right: 10px;
    text-align: right;
    float: left;
    line-height: 34px;
    color: #666;
  }
}
.radioitem {
  height: 34px;
  line-height: 14px;
  margin: 15px 0 15px 0;
  .radio {
    height: 14px;
    line-height: 14px;
    float: left;
    margin-top: 10px;
    width: auto;
    margin-left: 0;
    li {
      margin-right: 40px;
      font-size: 14px;
      color: #333;
      cursor: pointer;
      padding-left: 22px;
      display: inline-block;
      background: url("~@/assets/images/common/radio.png") no-repeat -119px 0;
      float: left;
      width: auto;
    }
    li.selected {
      background-position: 0 0;
    }
    li.selected[type="cursor"] {
      cursor: default;
    }
  }
  label {
    width: 100px;
    padding-right: 10px;
    text-align: right;
    float: left;
    line-height: 34px;
    color: #666;
  }
}
.addtagbox {
  position: absolute;
  left: 50%;
  top: 50%;
  margin-left: -162px;
  margin-top: -86px;
  background: #fff;
  -webkit-border-radius: 0 2px 2px 0;
  -moz-border-radius: 0 2px 2px 0;
  -ms-border-radius: 0 2px 2px 0;
  -o-border-radius: 0 2px 2px 0;
  border-radius: 0 2px 2px 0;
  -webkit-box-shadow: 0 0 15px rgba(3, 111, 55, 0.19);
  -moz-box-shadow: 0 0 15px rgba(3, 111, 55, 0.19);
  -ms-box-shadow: 0 0 15px rgba(3, 111, 55, 0.19);
  -o-box-shadow: 0 0 15px rgba(3, 111, 55, 0.19);
  box-shadow: 0 0 15px rgba(3, 111, 55, 0.19);
  width: 324px;
  padding: 20px 0;
  z-index: 99;
  .tagitem {
    margin-bottom: 10px;
  }
  .tagitem .error {
    margin-left: 90px;
  }
  label {
    width: 90px;
  }
  input {
    width: 215px;
    border: 1px solid #e0e0e0;
    padding: 0 10px;
    line-height: 32px;
    display: inline-block;
    font-size: 14px;
    -webkit-border-radius: 2px;
    -moz-border-radius: 2px;
    -ms-border-radius: 2px;
    -o-border-radius: 2px;
    border-radius: 2px;
    height: 34px;
  }
  input.err {
    animation: errborder 1s;
    -moz-animation: errborder 1s;
    -webkit-animation: errborder 1s;
    -o-animation: errborder 1s;
    border-color: #fbae22;
    color: #fbae22;
  }
  input.yes {
    animation: myborder 1s;
    -moz-animation: myborder 1s;
    -webkit-animation: myborder 1s;
    -o-animation: myborder 1s;
    border-color: #e0e0e0;
    color: #333;
  }
}
.checkboxitem {
  height: 34px;
  line-height: 14px;
  margin: 15px 0 15px 0;
  .checkbox {
    height: 14px;
    line-height: 14px;
    float: left;
    margin-top: 10px;
    width: auto;
    margin-left: 0;
  }
  .checkbox li {
    margin-right: 40px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    padding-left: 22px;
    display: inline-block;
    float: left;
    position: relative;
  }
  .checkbox li:before {
    content: "";
    width: 12px;
    height: 12px;
    display: block;
    background: url("~@/assets/images/common/checkbox.png") no-repeat 0 0;
    position: absolute;
    left: 0;
    top: 1px;
  }
  .checkbox li.selected:before {
    background-position: 0 -12px;
  }
  label {
    width: 100px;
    padding-right: 10px;
    text-align: right;
    float: left;
    line-height: 34px;
    color: #666;
  }
}
.tb-lt {
  margin-left: 95px;
  .btn-lf {
    margin: 10px 0 15px 0;
  }
  .btn-lf a {
    height: 35px;
    line-height: 35px;
    display: inline-block;
    padding: 0 20px;
    background: #fcad1d;
    color: #fff;
  }
  .btn-lf a:hover {
    background: #e07900;
  }
  .file {
    border: 1px dashed #eee;
    border-left: 0;
    border-right: 0;
  }
  .file dt {
    height: 45px;
    line-height: 45px;
    background: #fafafa;
    color: #969696;
    border-bottom: 1px dashed #eee;
  }
  .file dd {
    height: 50px;
    line-height: 50px;
  }
  .file dd {
    border-bottom: 1px dashed #eee;
  }
  .file ul li:nth-child(1) {
    width: 190px;
    float: left;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .file ul li:nth-child(2) {
    text-align: center;
    padding-right: 20px;
    width: 150px;
    float: right;
  }
  .file ul li:nth-child(2) a {
    color: #333;
    border: 1px solid #ececec;
    border-radius: 2px;
    height: 30px;
    line-height: 30px;
    cursor: pointer;
    display: inline-block;
    padding: 0 10px;
    border-radius: 2px;
  }
  .file ul li:nth-child(2) a:hover {
    background: #f9f9f9;
  }
  .file ul li:nth-child(2) a[type="cursor"] {
    cursor: default;
  }
  .file ul li:nth-child(2) a[type="cursor"]:hover {
    background: #fff;
  }
}
.pop {
  width: 100%;
  height: 100%;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  right: 0;
  z-index: 998;
  .btngroup {
    padding-top: 10px;
    padding-bottom: 20px;
  }
  .layer {
    background: rgba(0, 0, 0, 0.3);
    width: 100%;
    height: 100%;
  }
  .show_pop {
    width: 405px;
    text-align: left;
    display: block;
    position: fixed;
    left: 50%;
    margin-left: -202px;
    top: 50%;
    margin-top: -119px;
    background: #fff;
    overflow: hidden;
    margin-top: -217px;
    .poptitle {
      line-height: 40px;
      height: 40px;
      border-bottom: 1px solid #e5e5e5;
      background: #f5f5f5;
    }
    .poptitle i {
      float: right;
      width: 12px;
      height: 12px;
      display: block;
      background: url("~@/assets/images/common/close.png") no-repeat 0 0;
      margin-top: 14px;
      margin-right: 20px;
      cursor: pointer;
    }
    .poptitle span {
      padding-left: 20px;
    }
    .popdis {
      text-align: center;
      line-height: 30px;
      padding: 24px 0;
    }
  }
  .myloc {
    height: 40px;
    padding: 0 30px;
    line-height: 40px;
    font-size: 14px;
    padding-right: 5px;
    a {
      color: #c6c6c6;
    }
    a.ainimate {
      color: #14cb6b;
    }
  }
}
.tree {
  padding: 0 30px 30px 30px;
  height: 336px;
  overflow-y: auto;
  ul {
    border-bottom: 1px solid #ececec;
  }
  ul li {
    border: 1px solid #ececec;
    border-bottom: 0;
    line-height: 40px;
    cursor: pointer;
    position: relative;
    padding-right: 44px;
  }
  ul li .father {
    position: relative;
    margin-left: 44px;
  }
  ul li .father em {
    position: absolute;
    right: 20px;
    top: 15px;
    display: none;
    width: 12px;
    height: 12px;
    background: url("~@/assets/images/common/manage/open.png") no-repeat 0 0;
  }
  ul li i {
    position: absolute;
    left: 15px;
    top: 15px;
    display: block;
    width: 12px;
    height: 12px;
    background: url("~@/assets/images/common/checkbox.png") no-repeat 0 0;
  }
  ul li.current i {
    background-position: 0 -12px;
  }
  ul li.current {
    background: #e0ffed;
  }
  ul li ul {
    border-bottom: 0;
  }
  ul li ul li {
    border-left: 0;
    border-right: 0;
    font-size: 12px;
    line-height: 34px;
  }
  ul li ul li .father {
    padding-left: 66px;
  }
}
.checkhide {
  background: #fafafa;
  border-left: 4px solid #fff;
  margin-top: 5px;
  padding: 12px 0;
  .hideline {
    height: 37px;
    line-height: 37px;
    margin-bottom: 15px;
    label {
      width: 180px;
      padding-right: 20px;
      text-align: right;
      display: inline-block;
      text-align: right;
    }
    .typeli {
      display: inline-block;
      position: relative;
      font-size: 0;
      span {
        width: 108px;
        line-height: 35px;
        background: #fff;
        height: 37px;
        border: 1px solid #ececec;
        text-align: center;
        color: #969696;
        display: inline-block;
        margin-right: 17px;
        font-size: 14px;
        -webkit-border-radius: 2px;
        -moz-border-radius: 2px;
        -ms-border-radius: 2px;
        -o-border-radius: 2px;
        border-radius: 2px;
      }
      span.hover {
        border-color: #16cb6d;
        background: #e0fdee;
        color: #16cb6d;
        position: relative;
        cursor: pointer;
      }
      span.hover:after {
        position: absolute;
        right: 0;
        bottom: 0;
        width: 22px;
        height: 22px;
        display: block;
        content: "";
        background: url("~@/assets/images/common/work-team/task_select_ico.png")
          no-repeat 0 0;
      }
      input {
        line-height: 17px;
        padding: 10px;
        border: 1px solid #cacaca;
        width: 233px;
      }
      i {
        font-style: normal;
        color: #999;
        position: absolute;
        left: 243px;
        top: 0;
        line-height: 37px;
        font-size: 14px;
        width: 200px;
      }
    }
    &:last-child {
      margin: 0;
    }
  }
}
.add_outtag_box {
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.65);
  position: fixed;
  left: 0;
  top: 0;
}
.taglist {
  display: inline-block;
  font-size: 14px;
  padding: 7px 14px;
  background: #fafafa;
  width: 760px;
  span {
    line-height: 17px;
    padding: 0 35px 0 15px;
    text-align: center;
    display: inline-block;
    margin-right: 10px;
    background: #fff;
    border: 1px solid #14cb6b;
    color: #14cb6b;
    font-size: 14px;
    position: relative;
    margin-bottom: 6px;
    i {
      display: block;
      background: url("~@/assets/images/common/work-team/close_hover.png")
        no-repeat 0 0;
      position: absolute;
      right: 11px;
      top: 3px;
      width: 10px;
      cursor: pointer;
      height: 10px;
    }
  }
  a {
    color: #14cb6b;
    padding-left: 10px;
    position: relative;
  }

  .addtagboxImp {
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -162px;
    margin-top: -86px;
    background: #fcfbfb;
    -webkit-border-radius: 0 2px 2px 0;
    -moz-border-radius: 0 2px 2px 0;
    -ms-border-radius: 0 2px 2px 0;
    -o-border-radius: 0 2px 2px 0;
    border-radius: 0 2px 2px 0;
    -webkit-box-shadow: 0 0 15px rgba(3, 111, 55, 0.19);
    -moz-box-shadow: 0 0 15px rgba(3, 111, 55, 0.19);
    -ms-box-shadow: 0 0 15px rgba(3, 111, 55, 0.19);
    -o-box-shadow: 0 0 15px rgba(3, 111, 55, 0.19);
    box-shadow: 0 0 15px rgba(3, 111, 55, 0.19);
    width: 474px;
    padding: 0px 0;
    z-index: 999;
    .tagitem {
      margin-bottom: 10px;
    }
  }
}
.addtag {
  font-size: 0;
  text-align: center;
  padding: 15px 0 20px 0;
  background-color: #fff;
  margin-top: 30px;

  span {
    display: inline-block;
    width: 90px;
    height: 34px;
    text-align: center;
    padding: 0;
    line-height: 34px;
    color: #333;
    border: 1px solid #ececec;
    -webkit-border-radius: 2px;
    -moz-border-radius: 2px;
    -ms-border-radius: 2px;
    -o-border-radius: 2px;
    border-radius: 2px;
    font-size: 14px;
    cursor: pointer;
    margin: 0;
  }
  span:hover {
    background: #f9f9f9;
  }
  span:first-child {
    margin-right: 12px;
    background: #fcad1d;
    color: #fff;
    border: 1px solid #fcad1d;
  }
  span:first-child:hover {
    border: 1px solid #e07900;
    background: #e07900;
  }
}
</style>
